package com.mswork.mes.service.impl;

import java.util.List;
import com.mswork.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mswork.mes.mapper.ProjectCargoMapper;
import com.mswork.mes.domain.ProjectCargo;
import com.mswork.mes.service.IProjectCargoService;

/**
 * 货物Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-06
 */
@Service
public class ProjectCargoServiceImpl implements IProjectCargoService
{
    @Autowired
    private ProjectCargoMapper projectCargoMapper;

    /**
     * 查询货物
     *
     * @param cargoId 货物主键
     * @return 货物
     */
    @Override
    public ProjectCargo selectProjectCargoByCargoId(Long cargoId)
    {
        return projectCargoMapper.selectProjectCargoByCargoId(cargoId);
    }

    /**
     * 查询货物列表
     *
     * @param projectCargo 货物
     * @return 货物
     */
    @Override
    public List<ProjectCargo> selectProjectCargoList(ProjectCargo projectCargo)
    {
        return projectCargoMapper.selectProjectCargoList(projectCargo);
    }

    /**
     * 新增货物
     *
     * @param projectCargo 货物
     * @return 结果
     */
    @Override
    public int insertProjectCargo(ProjectCargo projectCargo)
    {
        projectCargo.setCreateTime(DateUtils.getNowDate());
        return projectCargoMapper.insertProjectCargo(projectCargo);
    }

    /**
     * 修改货物
     *
     * @param projectCargo 货物
     * @return 结果
     */
    @Override
    public int updateProjectCargo(ProjectCargo projectCargo)
    {
        projectCargo.setUpdateTime(DateUtils.getNowDate());
        return projectCargoMapper.updateProjectCargo(projectCargo);
    }

    /**
     * 批量删除货物
     *
     * @param cargoIds 需要删除的货物主键
     * @return 结果
     */
    @Override
    public int deleteProjectCargoByCargoIds(Long[] cargoIds)
    {
        return projectCargoMapper.deleteProjectCargoByCargoIds(cargoIds);
    }

    /**
     * 删除货物信息
     *
     * @param cargoId 货物主键
     * @return 结果
     */
    @Override
    public int deleteProjectCargoByCargoId(Long cargoId)
    {
        return projectCargoMapper.deleteProjectCargoByCargoId(cargoId);
    }
}
